<div id="loading">(Please wait while dojo json-rpc client loads...)</div>
<script type="text/javascript" src="dojo_rpc_only.js"></script>
<script type="text/javascript">
	// create json-rpc service
	hostDef = {"serviceType": "JSON-RPC", "serviceURL": "jsonrpctest.cgi", "sync": true}
	host = new dojo.rpc.JsonService({smdObj:hostDef});
	
	// callback triggered by the 'Calculate' button on the page
	function doCalculate() {
	    var x, y, ret;
	    // fetch x and y from fields on page
	    x = parseFloat(document.getElementById("x").value);
	    y = parseFloat(document.getElementById("y").value);
	    // invoke the method synchronously, get result
	    // (you could do it asynchronously, by passing a third argument,
	    // a function which takes a single argument - result object)
	    //var myDeferred = host.add(x,y).addCallback(onCalculateDone);
	    var myDeferred = host.callRemote("pow", [x,y]).addCallback(onCalculateDone);
	    //var myDeferred = host.callRemote("pow", [x,y])
	    //myDeferred.addCallback(onCalculateDone);
	    //myDeferred.addErrback(onCalculateError);
	}
	// callback upon completion of json-rpc request
	function onCalculateDone(result) {document.getElementById("result").textContent = dojo.json.serialize(result);}
	function onCalculateError(err) {alert("ERROR: "+err.message);}
	
	
	// "onclick" function
	function doUpdateRunning() {var myDeferred = host.callRemote("get_names_of_running_workflows", []).addCallback(onUpdateRunningDone);}
	function onUpdateRunningDone(result) {
		for (var result_index in result) {
			document.getElementById("running_table2").innerHTML += '<tr><td>Deposition</td><td>done</td><td><a href=deposition_dashboard.php>click</a></td></tr>';
		    //document.getElementById("running_table").textContent += (result[result_index]);
		}
		//document.getElementById("result").textContent = dojo.json.serialize(result);
	}
	
	dojo.byId("loading").innerHTML = "";
</script>

<table>
 <tr>
  <td>pow(</td>
  <td><input type="text" id="x" name="x" size="3"></td>
  <td>, </td>
  <td><input type="text" id="y" name="y" size="3"></td>
  <td>) = </td>
  <td><span id="result"></span></td>
 </tr>
  <td colspan="6"><button onclick="doCalculate();">Calculate!</button></td>
 <tr>
 </tr>
</table>



<H1>Top-Level Dashboard: All Workflows</H1><p>All Processes:<table border=4>  <tr><th>Workflow</th><th>Status</th><th>Details</th>
<th>Actions</th></tr>  <tr><td>Glass Reception</td><td>done</td><td><a href=glass_reception_dashboard.php>click</a></td></tr>  
<tr><td>Glass Cleaning</td><td>done</td><td><a href=glass_cleaning_dashboard.php>click</a></td></tr>  
<tr><td>Deposition</td><td>done</td><td><a href=deposition_dashboard.php>click</a></td></tr>  
<tr><td>?Grids?</td><td>done</td><td><a href=grids_dashboard.php>click</a></td></tr><tr><td>Reliability Testing</td><td>done</td><td><a href=grids_dashboard.php>click</a></td></tr><tr><td>Data Analysis</td><td>running</td><td><a href=data_analysis_dashboard.php>click</a></td><td><a href=data_analysis_dashboard.php>start</a> / <a href=data_analysis_dashboard.php>stop</a></td></tr></table>

<p>Running Processes (<a style="{text-decoration:underline; color:blue;}" onclick="doUpdateRunning();">update</a>):
<br>

<table border=4 id="running_table2">  <tr><th>Workflow</th><th>Status</th><th>Details</th><th>Actions</th></tr> 
<tr><td>Glass Reception</td><td>done</td><td><a href=glass_reception_dashboard.php>click</a></td></tr>  

<span id="running_table">ggg</span>

<tr><td>Glass Cleaning</td><td>done</td><td><a href=glass_cleaning_dashboard.php>click</a></td></tr>  <tr><td>Deposition</td><td>done</td><td><a href=deposition_dashboard.php>click</a></td></tr>  <tr><td>?Grids?</td><td>done</td><td><a href=grids_dashboard.php>click</a></td></tr><tr><td>Reliability Testing</td><td>done</td><td><a href=grids_dashboard.php>click</a></td></tr><tr><td>Data Analysis</td><td>running</td><td><a href=data_analysis_dashboard.php>click</a></td><td><a href=data_analysis_dashboard.php>start</a> / <a href=data_analysis_dashboard.php>stop</a></td></tr></table>